//
//  ItemCell.m
//  LessoDemo
//
//  Created by decade on 27/12/2017.
//  Copyright © 2017 Lesso. All rights reserved.
//

#import "ItemCell.h"

@implementation ItemCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier data:(NSDictionary *)data {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 80, 80)];
        [img setImage:[UIImage imageNamed:data[@"img"]]];
        [self.contentView addSubview:img];
        
        UILabel *titleLb = [[UILabel alloc]initWithFrame:CGRectMake(110, 10, 200, 20)];
        titleLb.text = data[@"title"];
        [self.contentView addSubview:titleLb];
        
        UILabel *priceLb = [[UILabel alloc]initWithFrame:CGRectMake(110, 70, 200, 20)];
        priceLb.text = data[@"price"];
        priceLb.textColor = [UIColor orangeColor];
        [self.contentView addSubview:priceLb];
        
        UIButton *buyBtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-90, 60, 80, 30)];
        buyBtn.backgroundColor = [UIColor orangeColor];
        [buyBtn setTitle:@"Buy Now!" forState:UIControlStateNormal];
        buyBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:buyBtn];
    }
    return self;
}

@end
